import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: GodK
 * Date: 2024-09-17
 * Time: 21:23
 */
public class Test {
    public static void main13253(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int m = scan.nextInt();
        int[][] in = new int[n+1][2];
        int[][] dp = new int[n+1][m+1];
        for (int i = 1; i <= n; i++) {
            in[i][0] = scan.nextInt();
            in[i][1] = scan.nextInt();
        }
        for(int i = 1;i <= n;i++){
            for(int j = 0;j <= m;j++){
                dp[i][j] = dp[i - 1][j];
                if(j >= in[i][0]){
                    dp[i][j] = Math.max(dp[i][j],dp[i][j - in[i][0]]+in[i][1]);
                }
            }
        }
        scan.close();
    }
    private static class Pair<K,V>{
        int x1,x2;
        public Pair(int x1,int x2){
            this.x1 = x1;
            this.x2 = x2;
        }
        public int getKey(){
            return x1;
        }
        public int getValue(){
            return x2;
        }
    }
    public static HashMap<Long,Long> map;
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        map = new HashMap<>();
        int n = scan.nextInt();
        int[] in = new int[n];
        for(int i = 0;i < n;i++)in[i] = scan.nextInt();
        long ret = 0;
        long sum = 0;
        for(int num : in)sum += dfs(num);
        long index = 1;
        while(dfs(index) != sum)index++;
        System.out.println(index);
        scan.close();
    }
    public static long dfs(long a){
        if(map.containsKey(a)){
            return map.get(a);
        }
        if(a == 1L){
            if(!map.containsKey(1L))map.put(1L,1L);
            return map.get(1L);
        }
        map.put(a,a * dfs(a - 1));
        return map.get(a);
    }
}
